package com.qf.hospital.system.service.impl;

import com.qf.hospital.system.entity.Paiban;
import com.qf.hospital.system.mapper.PaibanMapper;
import com.qf.hospital.system.service.PaibanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class PaibanServiceImpl implements PaibanService {

    @Autowired
    private PaibanMapper paibanMapper;


    @Override
    public List<Map<String, Object>> findPaibanByWeek(String week) {
        //1. mapper查询
        List<Paiban> list = paibanMapper.findPaibanByWeek(week);

        //2. 封装为Map的List集合
        List<Map<String, Object>> result = new ArrayList<>();
        for (Paiban paiban : list) {
            Map<String,Object> map = new HashMap<>();
            map.put("doctorName",paiban.getDoctorName());
            result.add(map);
        }

        //3. 返回
        return result;
    }
}
